﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Barbar.MapReport.Common.Drawing.Commands;
using System.Collections.ObjectModel;
using Barbar.MapReport.Common;
using Barbar.MapReport.HtmlRender;
using Barbar.MapReport.Configuration;
using System.Drawing;

public partial class LineExample : MapReportDemoPage {
  protected void Page_Load(object sender, EventArgs e) {
    AddLinesCommand command = new AddLinesCommand();
    GeoLine line = null;
    
    line = new GeoLine(new GeoPoint(49, 10), new GeoPoint(51, 10));
    line.SerializedColor = new SerializedColor(Color.Red);
    line.Width = 5;
    command.Lines.Add(line);

    line = new GeoLine(new GeoPoint(51, 10), new GeoPoint(51, 12));
    line.SerializedColor = new SerializedColor(Color.Green);
    line.Width = 5;
    command.Lines.Add(line);
    
    line = new GeoLine(new GeoPoint(51, 12), new GeoPoint(49, 12));
    line.SerializedColor = new SerializedColor(Color.Blue);
    line.Width = 5;
    command.Lines.Add(line);
    
    line = new GeoLine(new GeoPoint(49, 12), new GeoPoint(49, 10));
    line.SerializedColor = new SerializedColor(Color.Brown);
    line.Width = 5;
    command.Lines.Add(line);
    
    command.Offset = 15;

    RenderingService renderService = new RenderingService();
    renderService.Execute(command);

    RenderSettings settings = new RenderSettings(new SerializedUnit(800), new SerializedUnit(600), 51, 11, 6, MapConfigurationManager.MapSettings.GoogleKeyProvider.DefaultGoogleKey, 2057);
    settings.EnableGoogleBar = true;

    MapHtmlFragment fragment = renderService.Render(settings);
    litMapDiv.Text = fragment.MapElement;

  }
}
